// 创建一个路由器，并暴露出去
// 1.引入
import { createRouter,createWebHistory } from "vue-router";

// 引入可能要呈现的组件
// 路由组件一般放在pages/views文件夹中
// 普通组件是通过标签引入使用，但路由组件不需要
import Home from "@/pages/Home.vue";
import News from "@/pages/News.vue";
import About from "@/pages/About.vue";
import Details from "@/pages/details.vue";

// 2.创建路由器
const router = createRouter({
  history:createWebHistory(), 
  // 一个一个的路由规则
  routes:[
    {
      name:'xinwen',
      path:'/news',
      component:News,
      children:[
        {
          name:'xiangqing',
          path:'detail',
          component:Details
        }
      ]
    },
    {
      name:'shouye',
      path:'/home',
      component:Home
    },
    
    {
      name:'guanyu',
      path:'/about',
      component:About
    },
  ]
})
export default router